<template>
  <!-- 产线停产 -->
  <el-dialog title="销售出库" :visible.sync="showFlag" :modal="false" width="40%">
    <div class="app-container" style="padding-top: 0px">
      <el-form
        ref="form"
        class="perForm"
        :model="form"
        :rules="rules"
        label-width="120px"
        size="medium"
        @close="cancel"
      >
        <el-form-item label="承运商" prop="vendorCode">
          <el-select v-model="form.vendorCode" style="width: 350px;" filterable placeholder="请选择">
            <el-option
              v-for="item in remarkList"
              :key="item.vendorCode"
              :label="item.vendorName"
              :value="item.vendorCode"
            ></el-option>
          </el-select>
          <!-- <el-input v-model="form.carrier" :controls="false"></el-input> -->
        </el-form-item>
        <el-form-item label="运费" prop="freight">
          <el-input v-model="form.freight" :controls="false"></el-input>
        </el-form-item>
         <el-form-item label="运输单号" prop="transportNumber">
          <el-input v-model="form.transportNumber" :controls="false"></el-input>
        </el-form-item>
        <el-form-item label="快递车牌" prop="deliveryPlate">
          <el-input v-model="form.deliveryPlate" :controls="false"></el-input>
        </el-form-item>
      </el-form>

      <!-- <div slot="footer" class="dialog-footer">
        <el-button @click="reset" style="font-size: 24px;">重 置</el-button>
        <el-button type="primary" style="font-size: 24px;" @click="submitForm">提 交</el-button>
      </div>-->
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirmSelect">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>
    
<script>
// reportAll
import { warehousingDeliverynotice,selectAll,warehousingAdd  } from "@/api/mes/wm/deliveryGoods";
import { baseList } from "@/api/apppro/index";
export default {
  name: "productReport",
  data() {
    return {
      showFlag: false,
      form: {},
      rules: {
        vendorCode: [
          { required: true, message: "承运商不能为空", trigger: "change" }
        ],
        deliveryPlate: [
          { required: true, message: "快递车牌不能为空", trigger: "blur" }
        ],
        freight: [
          { required: true, message: "运费不能为空", trigger: "blur" }
        ],
        transportNumber: [
          { required: true, message: "运输单号不能为空", trigger: "blur" }
        ]
      },
      remarkList: [],
    };
  },
  methods: {
    init(row) {
      console.log(row, "row");
      this.form = { ...row };
      this.getList()
      this.showFlag = true;
    },
    getList() {
      selectAll({}).then(res => {
        this.remarkList = res.rows || [];
        console.log(res, "==========res===========");
      });
    },

    //确定
    confirmSelect() {
      let param = {
        vendorCode: this.form.vendorCode,
        freight: this.form.freight,
        deliveryPlate:this.form.deliveryPlate,
        transportNumber:this.form.transportNumber,
        deliveryNoticeId:this.form.id
      };
      this.$refs.form.validate(valid => {
        if (valid) {
          warehousingAdd(param).then(res => {
            if (res.code == 200) {
              this.showFlag = false;
              this.$message.success(res.msg);
              this.$parent.getList();
            }
          });
        }
      });
    },
    cancel(){
      this.showFlag=false
      this.form = {}
    }
  }
};
</script>
    <style lang="scss" scoped>
// .contentDiv {
//   width: 1350px;
// }
.el-table {
  margin-bottom: 15px;
}
</style>